# Copyright (C) 2013 Robby Zeitfuchs
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import logging
import os

from lib.community.antivir import Antivir
from lib.cuckoo.common.abstracts import Processing
from lib.cuckoo.common.objects import File

log = logging.getLogger(__name__)

class DroppedAntivir(Processing):
    """Dropped files antivir analysis."""

    def run(self):
        self.key = "dropped_antivir"
        results = {}
        
        for dir_name, dir_names, file_names in os.walk(self.dropped_path):
            for file_name in file_names:
                file_path = os.path.join(dir_name, file_name)
                file_info = File(file_path=file_path, strip_name=True).get_all()
                
                if 'executable' in file_info['type']:
                    print self.file_path
                    #results[file_name]["avira"] = Antivir().avira(self.file_path)
                    #results[file_name]["avg"] = Antivir().avg(self.file_path)
                    #results[file_name]["clamav"] = Antivir().clamav(self.file_path)
        
        return "Test"#results

